#include "EmptyList.h"
#include "ISeq.h"
#include "CjObject.h"
#include "PersistentList.h"
#include "IPersistentMap.h"

namespace clojure_lang {
EmptyList::EmptyList(void)
{
}

EmptyList::EmptyList(Ref(IPersistentMap) meta) : CjObject(meta)
{
}


EmptyList::~EmptyList(void)
{
}


CjObject *EmptyList::first()
{
        return NULL;
}

ISeq *EmptyList::next()
{
        return NULL;
}

ISeq *EmptyList::more()
{
        return NULL;
}


int EmptyList::count() {
	return 0;
}

ISeq *EmptyList::seq()
{
        return NULL;
}

IPersistentCollection *EmptyList::empty()
{
        return this;
}

bool EmptyList::equals(CjObject *obj)
{
        return (!obj->dynamicCast<Seqable>() == NULL)
                && (obj->dynamicCast<Seqable>()->seq() == NULL);
}

bool EmptyList::equiv(CjObject *obj)
{
	return equals(obj);
}

CjObject *EmptyList::peek()
{
        return NULL;
}

IPersistentStack *EmptyList::pop()
{
	///TODO
        return NULL;
}


IPersistentCollection *EmptyList::cons(CjObject *o)
{
    return new PersistentList(meta(), o, NULL, 1);
}

int EmptyList::getHashCode()
{
    return 1;
}

CjObject *EmptyList::withMeta(IPersistentMap *meta)
{
    if (meta != _meta)
        return new EmptyList(meta);
    return this;

}

}
